\section{th\_\-quant\_\-info Struct Reference}
\label{structth__quant__info}\index{th\_\-quant\_\-info@{th\_\-quant\_\-info}}
A complete set of quantization parameters.  


{\tt \#include $<$codec.h$>$}

\subsection*{Data Fields}
\begin{CompactItemize}
\item 
ogg\_\-uint16\_\-t {\bf dc\_\-scale} [64]
\begin{CompactList}\small\item\em The DC scaling factors. \item\end{CompactList}\item 
ogg\_\-uint16\_\-t {\bf ac\_\-scale} [64]
\begin{CompactList}\small\item\em The AC scaling factors. \item\end{CompactList}\item 
unsigned char {\bf loop\_\-filter\_\-limits} [64]
\begin{CompactList}\small\item\em The loop filter limit values. \item\end{CompactList}\item 
{\bf th\_\-quant\_\-ranges} {\bf qi\_\-ranges} [2][3]
\begin{CompactList}\small\item\em The {\em qi\/} ranges for each {\em ci\/} and {\em pli\/}. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
A complete set of quantization parameters. 

The quantizer for each coefficient is calculated as: 

\begin{Code}\begin{verbatim}    Q=MAX(MIN(qmin[qti][ci!=0],scale[ci!=0][qi]*base[qti][pli][qi][ci]/100),
     1024).
\end{verbatim}
\end{Code}



{\em qti\/} is the quantization type index: 0 for intra, 1 for inter. {\tt ci!=0} is 0 for the DC coefficient and 1 for AC coefficients. {\em qi\/} is the quality index, ranging between 0 (low quality) and 63 (high quality). {\em pli\/} is the color plane index: 0 for Y', 1 for Cb, 2 for Cr. {\em ci\/} is the DCT coefficient index. Coefficient indices correspond to the normal 2D DCT block ordering--row-major with low frequencies first--{\em not\/} zig-zag order.

Minimum quantizers are constant, and are given by: 

\begin{Code}\begin{verbatim}   qmin[2][2]={{4,2},{8,4}}.
\end{verbatim}
\end{Code}



Parameters that can be stored in the bitstream are as follows:\begin{itemize}
\item The two scale matrices ac\_\-scale and dc\_\-scale. 

\begin{Code}\begin{verbatim}      scale[2][64]={dc_scale,ac_scale}.
\end{verbatim}
\end{Code}

\item The base matrices for each {\em qi\/}, {\em qti\/} and {\em pli\/} (up to 384 in all). In order to avoid storing a full 384 base matrices, only a sparse set of matrices are stored, and the rest are linearly interpolated. This is done as follows. For each {\em qti\/} and {\em pli\/}, a series of {\em n\/} {\em qi\/} ranges is defined. The size of each {\em qi\/} range can vary arbitrarily, but they must sum to 63. Then, {\tt n+1} matrices are specified, one for each endpoint of the ranges. For interpolation purposes, each range's endpoints are the first {\em qi\/} value it contains and one past the last {\em qi\/} value it contains. Fractional values are rounded to the nearest integer, with ties rounded away from zero.\end{itemize}


Base matrices are stored by reference, so if the same matrices are used multiple times, they will only appear once in the bitstream. The bitstream is also capable of omitting an entire set of ranges and its associated matrices if they are the same as either the previous set (indexed in row-major order) or if the inter set is the same as the intra set.

\begin{itemize}
\item Loop filter limit values. The same limits are used for the loop filter in all color planes, despite potentially differing levels of quantization in each.\end{itemize}


For the current encoder, {\tt scale[ci!=0][qi]} must be no greater than {\tt scale[ci!=0][qi-1]} and {\tt base[qti][pli][qi][ci]} must be no greater than {\tt base[qti][pli][qi-1][ci]}. These two conditions ensure that the actual quantizer for a given {\em qti\/}, {\em pli\/}, and {\em ci\/} does not increase as {\em qi\/} increases. This is not required by the decoder. 

\subsection{Field Documentation}
\index{th\_\-quant\_\-info@{th\_\-quant\_\-info}!dc\_\-scale@{dc\_\-scale}}
\index{dc\_\-scale@{dc\_\-scale}!th_quant_info@{th\_\-quant\_\-info}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ogg\_\-uint16\_\-t {\bf th\_\-quant\_\-info::dc\_\-scale}[64]}\label{structth__quant__info_d5c1c0d1aa4127fcf864ae747d732ed9}


The DC scaling factors. 

\index{th\_\-quant\_\-info@{th\_\-quant\_\-info}!ac\_\-scale@{ac\_\-scale}}
\index{ac\_\-scale@{ac\_\-scale}!th_quant_info@{th\_\-quant\_\-info}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ogg\_\-uint16\_\-t {\bf th\_\-quant\_\-info::ac\_\-scale}[64]}\label{structth__quant__info_102f079c8f4a135dc0895c10768aeb06}


The AC scaling factors. 

\index{th\_\-quant\_\-info@{th\_\-quant\_\-info}!loop\_\-filter\_\-limits@{loop\_\-filter\_\-limits}}
\index{loop\_\-filter\_\-limits@{loop\_\-filter\_\-limits}!th_quant_info@{th\_\-quant\_\-info}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned char {\bf th\_\-quant\_\-info::loop\_\-filter\_\-limits}[64]}\label{structth__quant__info_4ac56bf0a45b5743b36daf85d5cd9e33}


The loop filter limit values. 

\index{th\_\-quant\_\-info@{th\_\-quant\_\-info}!qi\_\-ranges@{qi\_\-ranges}}
\index{qi\_\-ranges@{qi\_\-ranges}!th_quant_info@{th\_\-quant\_\-info}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf th\_\-quant\_\-ranges} {\bf th\_\-quant\_\-info::qi\_\-ranges}[2][3]}\label{structth__quant__info_6feacf4b365e305a7df7b93d87ee7bb8}


The {\em qi\/} ranges for each {\em ci\/} and {\em pli\/}. 



The documentation for this struct was generated from the following file:\begin{CompactItemize}
\item 
{\bf codec.h}\end{CompactItemize}
